Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/base skeleton #1

Merged
merged 11 commits into from
Aug 9, 2024
Merged

Feat/base skeleton #1

merged 11 commits into from
Aug 9, 2024

Conversation

amimart
Copy link
Member

@amimart amimart commented Aug 7, 2024

This PR brings preliminary design skeleton to the SDK, nothing functional. the intent is to setup a base on interfaces.

πŸ—‚οΈ Structure

Find below details on the different go modules:

β”œβ”€β”€ auth        # Content related to the authentication of identities against the protocol in a generic way.
β”‚Β Β  └── jwt     # Content related to the management of identities through JWT tokens.
β”œβ”€β”€ dataverse   # Contains client elements to interact with the dataverse.
β”œβ”€β”€ http        # Carry an http server configurable enough to simply build http connectors for services.
β”œβ”€β”€ keys        # Carry the logic related to cryptographic keys.
└── provider    # Contains the logic associated with different types of resources providing services (e.g. storage, computation, etc...).
    └── storage # Implement an extensible storage service proxy, providing the base implementation allowing to customise the underlying logic.

🌐 Main components

auth.Proxy

A generic component to authenticate an identity given a signed credential, exposing a single Authenticate func. The idea is to be agnostic on the way the authentication is served (e.g. rest, gRPC...) and carry here only the business logic. the jwt.Factory can use it to issue JWT tokens and provide configuration elements to issue and verify jwt tokens on an http server.

storage.Proxy

A component to implement storage service proxies, taking care of all the generic tasks:

  • Authentication through auth.Proxy
  • Authorization on read & store requests

The specific logic to implement with an S3 for example is achieved by providing related functions when instantiating it.

It is also agnostic to the transport layer in its implementation, it offers configuration elements for an http server but could eventually be exposed in a different way.

dataverse.Client

Provide interactions with the protocol with a business logic dataverse oriented.

http.Server

An http server intended to be configured directly by proxy implementation to be served over http.

πŸ“Ί Example

Here is an example of a storage connector implementation using these:

ctx := context.Background()
var dataverseClient dataverse.Client
serviceKeys, _ := keys.NewKeyFromMnemonic("")

storageProxy, _ := storage.NewProxy(
    ctx,
    serviceKeys,
    dataverseClient,
    func(ctx context.Context, resourceID string) (io.Reader, error) {
        // Implement specific read logic here
        return bytes.NewReader([]byte("resource data")), nil
    },
    func(ctx context.Context, resourceID string, data io.Reader) error {
        // Implement specific store logic here
        return nil
    },
)

axonehttp.NewServer(
    "0.0.0.0:8080",
    storageProxy.HTTPConfigurator([]byte("jwt_secret_key"), 5*time.Minute),
).Listen()

πŸ™ˆ Missing

There is currently no canonical error handling here.

SSI & verifiable credentials management are also not covered currently.

❓Remarks

@ccamel @bdeneux Let's challenge everything, structure, naming, etc..

Some methods are pre-implemented to give an idea of their scopes.

@amimart amimart self-assigned this Aug 7, 2024
Copy link
Contributor

coderabbitai bot commented Aug 7, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces significant enhancements to an authentication framework, including new structures and functionalities for handling JWT (JSON Web Tokens) and managing decentralized identities. Key additions encompass an Identity struct for representing authenticated users, a Proxy interface for authentication via verifiable credentials, and various HTTP handlers for managing requests. The update also refines the project's documentation and configuration files, ensuring that unnecessary files are ignored during version control.

Changes

File(s) Change Summary
.gitignore Added entries for target/, .idea/, and .DS_Store to prevent unnecessary files from being tracked.
README.md Updated project name to "axone-sdk" and modified lint badge URL.
auth/http.go, auth/identity.go, auth/jwt/..., auth/proxy.go Introduced new files and types for authentication, JWT claims, and proxy management.
dataverse/client.go Added Client interface for interacting with governance commands.
http/server.go Created an HTTP server structure using Gorilla Mux router.
keys/key.go Defined a Key struct for cryptographic key management.
provider/storage/http.go, provider/storage/proxy.go Added HTTP handling functionalities and proxy management for resource access.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Server
    participant AuthService
    participant Proxy
    participant Storage

    Client->>Server: HTTP Request
    Server->>AuthService: Authenticate
    AuthService-->>Server: Identity
    Server->>Proxy: Authenticate with Identity
    Proxy-->>Server: Authorization Result
    Server->>Storage: Access Resource
    Storage-->>Server: Resource Data
    Server-->>Client: HTTP Response
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@amimart amimart requested review from ccamel and bdeneux August 7, 2024 13:20
Copy link
Contributor

@bdeneux bdeneux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems very good ! I don't see any remarks about structure or naming. I think we will do some adjustment during implementation but that seems good. Good job πŸ‘

provider/storage/http.go Outdated Show resolved Hide resolved
Copy link
Member

@ccamel ccamel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good! Let's go.

@amimart amimart marked this pull request as ready for review August 9, 2024 07:10
@amimart
Copy link
Member Author

amimart commented Aug 9, 2024

Let's begin with that then :)

@amimart amimart merged commit c177d58 into main Aug 9, 2024
6 checks passed
@amimart amimart deleted the feat/base-skeleton branch August 9, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants